home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / DEMOS / WATER.ZIP / WATER.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-12-15  |  29.8 KB  |  988 lines

  1.         .Model Small,C
  2.         .Stack 400
  3.         .Seq
  4.         .386P
  5.         Jumps
  6.         Locals
  7.  
  8. Semilla_Inicial         Equ     9234H
  9. Ancho_Olas              Equ     0002
  10. Densidad_Inicial        Equ     0005
  11. Syncronize              Equ     0000
  12. Borde                   Equ     0002
  13. Ancho                   Equ     0160
  14. Alto                    Equ     0100
  15. Maximo                  Equ     0150
  16. Ancho_Puntos            Equ     0320
  17. Debug_Test              Equ     0000
  18. Crlf                    Equ     0Dh,0Ah
  19.  
  20.         .Code
  21.  
  22. ;***************************************************************************
  23. ;  Transporta la tabla de vectorización
  24. ;***************************************************************************
  25. St_Lidt         Proc
  26.         Xor     Ax,Ax
  27.         Mov     Ds,Ax
  28.         Mov     Es,Ax
  29.         Mov     Si,8H
  30.         Shl     Si,2
  31.         Mov     Di,50H
  32.         Shl     Di,2
  33.         Mov     Cx,8*2
  34.         Rep     Movsw
  35.         Cli
  36.         In      Al,21H
  37.         Push    Ax
  38.         Mov     Al,0Ffh
  39.         Out     21H,Al
  40. @@1:
  41.         Cli
  42.         Mov     Al,0Bh
  43.         Out     20H,Al
  44.         In      Al,20H
  45.         Sti
  46.         Nop
  47.         Nop
  48.         Nop
  49.         Or      Al,Al
  50.         Jnz     @@1
  51.         Mov     Dx,20H
  52.         Mov     Al,11H
  53.         Out     Dx,Al
  54.         Nop
  55.         Mov     Dx,21H
  56.         Mov     Al,50H
  57.         Out     Dx,Al
  58.         Nop
  59.         Mov     Al,04H
  60.         Out     Dx,Al
  61.         Nop
  62.         Mov     Al,01H
  63.         Out     Dx,Al
  64.         Nop
  65.         Mov     Al,0Ffh
  66.         Out     Dx,Al
  67.         Pop     Ax
  68.         Out     21H,Al
  69.         Ret
  70. St_Lidt         Endp
  71.  
  72. ;***************************************************************************
  73. ;  Restaura la tabla de vectorización
  74. ;***************************************************************************
  75. Cl_Lidt Proc
  76.         Xor     Ax,Ax
  77.         Mov     Ds,Ax
  78.         Mov     Es,Ax
  79.         Mov     Si,50H
  80.         Shl     Si,2
  81.         Mov     Di,8H
  82.         Shl     Di,2
  83.         Mov     Cx,8*2
  84.         Rep     Movsw
  85.         Cli
  86.         In      Al,21H
  87.         Push    Ax
  88.         Mov     Al,0Ffh
  89.         Out     21H,Al
  90. @@1:
  91.         Cli
  92.         Mov     Al,0Bh
  93.         Out     20H,Al
  94.         In      Al,20H
  95.         Sti
  96.         Nop
  97.         Nop
  98.         Nop
  99.         Or      Al,Al
  100.         Jnz     @@1
  101.         Mov     Dx,20H
  102.         Mov     Al,11H
  103.         Out     Dx,Al
  104.         Nop
  105.         Mov     Dx,21H
  106.         Mov     Al,8H
  107.         Out     Dx,Al
  108.         Nop
  109.         Mov     Al,04H
  110.         Out     Dx,Al
  111.         Nop
  112.         Mov     Al,01H
  113.         Out     Dx,Al
  114.         Nop
  115.         Mov     Al,0Ffh
  116.         Out     Dx,Al
  117.         Pop     Ax
  118.         Out     21H,Al
  119.         Ret
  120. Cl_Lidt Endp
  121.  
  122. ;***************************************************************************
  123. ;  Anula todas las IRQs del IMR excepto la 1 (INT 09h)
  124. ;***************************************************************************
  125. Irqs_Out        Proc
  126.         In      Al,21H
  127.         Mov     Cs:[Imr],Al  
  128.         Or      Al,011111111B
  129.         And     Al,011111101B
  130.         Out     21H,Al
  131.         Ret
  132. Irqs_Out        Endp
  133.  
  134. ;***************************************************************************
  135. ;  Deja el registro InterruptMaskRegister tal y como estaba al iniciar
  136. ;  la ejecución
  137. ;***************************************************************************
  138. Restore_Imr     Proc
  139.         Mov     Al,Cs:[Imr]
  140.         Out     21H,Al
  141.         Ret
  142. Restore_Imr     Endp
  143.  
  144. ;***************************************************************************
  145. ;  Establece el nuevo vector de la IRQ1, para que apunte hacia el handle
  146. ;  'keyboard' del propio codigo
  147. ;***************************************************************************
  148. Set_Irq1        Proc
  149.         Xor     Ax,Ax
  150.         Mov     Ds,Ax
  151.         Mov     Eax,Dword Ptr Ds:[4H+50H*4]
  152.         Mov     Dword Ptr Cs:[Old_09H],Eax
  153.         Cli
  154.         Mov     Word Ptr Ds:[4H+50H*4],Offset Keyboard
  155.         Mov     Word Ptr Ds:[4H+2+50H*4],Cs
  156.         Sti
  157.         Ret
  158. Set_Irq1        Endp
  159.  
  160. ;***************************************************************************
  161. ;  Handle para la INT 09h
  162. ;***************************************************************************
  163. Keyboard        Proc
  164.         Push    Ax
  165.         In      Al,60H
  166.         Test    Al,80H
  167.         Jz      @@1
  168.         Mov     Al,20H
  169.         Out     20H,Al
  170.         Pop     Ax
  171.         Iret
  172. @@1:
  173.         Add     Sp,8
  174.         Xor     Ax,Ax
  175.         Mov     Ds,Ax
  176.         Cli
  177.         Mov     Eax,Dword Ptr Cs:[Old_09H]
  178.         Mov     Dword Ptr Ds:[4H+50H*4],Eax
  179.         Sti
  180.         Mov     Al,20H
  181.         Out     20H,Al
  182.         Jmp     End_Proc
  183. Keyboard        Endp
  184.  
  185. ;***************************************************************************
  186. ;  Pone los registros de segmento apuntando a la VRAM y al buffer de la
  187. ;  tabla, borra el buffer y cambia al modo 13h (320*200*256)
  188. ;***************************************************************************
  189. Put_320 Proc
  190.         Push    Cs
  191.         Pop     Ds
  192.         Mov     Ax,0A000H
  193.         Mov     Es,Ax
  194.         Mov     Ax,Seg Uninit
  195.         Mov     Gs,Ax
  196.         Push    Es
  197.         Push    Gs
  198.         Pop     Ax
  199.         Mov     Es,Ax
  200.         Xor     Di,Di
  201.         Mov     Cx,65535
  202.         Xor     Al,Al
  203.         Rep     Stosb
  204.         Pop     Es
  205.         Call    Zero_Pal
  206.         Mov     Ax,0013H
  207.         Int     10H
  208.         Ret
  209. Put_320 Endp
  210.  
  211. ;***************************************************************************
  212. ;  Pone el modo texto
  213. ;***************************************************************************
  214. Text_Mode       Proc
  215.         Mov     Ax,0003H
  216.         Int     10H
  217.         Ret
  218. Text_Mode       Endp
  219.  
  220. ;***************************************************************************
  221. ;  Espera un retrazo y cambia el color del borde si la constante
  222. ;  'debug_test' está a 1
  223. ;***************************************************************************
  224. Vsync   Proc
  225. If      Debug_Test
  226.         Mov     Dx,3Dah
  227.         In      Al,Dx
  228.         Mov     Dx,3C0H
  229.         Mov     Al,31H
  230.         Out     Dx,Al
  231.         Mov     Al,80
  232.         Out     Dx,Ax
  233. Endif
  234.         Mov     Dx,03Dah
  235. @@1:    In      Al,Dx
  236.         Test    Al,8
  237.         Jnz     @@1
  238. @@2:    In      Al,Dx
  239.         Test    Al,8
  240.         Jz      @@2
  241. If      Debug_Test
  242.         Mov     Dx,3Dah
  243.         In      Al,Dx
  244.         Mov     Dx,3C0H
  245.         Mov     Al,31H
  246.         Out     Dx,Al
  247.         Mov     Al,0
  248.         Out     Dx,Ax
  249. Endif
  250.         Ret
  251. Vsync   Endp
  252.  
  253. ;***************************************************************************
  254. ;  Pone la paleta a 0, para evitar cambios bruscos
  255. ;***************************************************************************
  256. Zero_Pal        Proc
  257.         Mov     Dx,3C8H
  258.         Xor     Al,Al                  
  259.         Out     Dx,Al
  260.         Inc     Dx
  261.         Xor     Al,Al
  262.         Mov     Cx,768
  263. @@1:
  264.         Out     Dx,Al
  265.         Loop    @@1
  266.         Ret
  267. Zero_Pal        Endp
  268.  
  269. ;***************************************************************************
  270. ;  Pone en el DAC la paleta del buffer 'palette'
  271. ;***************************************************************************
  272. Put_Palette     Proc
  273.         Mov     Dx,3C8H
  274.         Xor     Al,Al                  
  275.         Out     Dx,Al
  276.         Inc     Dx
  277.         Mov     Si,Offset Palette
  278.         Mov     Cx,450
  279. @@1:    Mov     Al,[Si]
  280.         Inc     Si
  281.         Out     Dx,Al                  
  282.         Loop    @@1
  283.         Ret
  284. Put_Palette     Endp
  285.  
  286. ;***************************************************************************
  287. ;  Imprime la pagina actual ('actual_page') y espera un sincronismo si la
  288. ;  constante 'syncronize' está a 1.
  289. ;***************************************************************************
  290. Print_Frame     Proc
  291.         Mov     Si,Word Ptr Cs:[Actual_Page]
  292.         Mov     Di,64000
  293.         Mov     Cx,Ancho
  294. @@4:
  295.         Push    Di Cx
  296.         Xor     Ax,Ax
  297.         Xor     Dx,Dx
  298.         Xor     Bx,Bx
  299. @@3:
  300.         Mov     Cx,Word Ptr Gs:[Si]
  301.         Sar     Cx,7
  302.         Add     Cx,Ax
  303.         Sub     Cx,Dx
  304.         Jle     @@1
  305.         Add     Dx,Cx
  306. @@2:
  307.         Mov     Word Ptr Es:[Di],Bx
  308.         Sub     Di,Ancho_Puntos
  309.         Loop    @@2
  310. @@1:
  311.         Add     Si,2
  312.         Add     Bx,0101H
  313.         Inc     Ax
  314.         Cmp     Ax,Alto
  315.         Jnz     @@3
  316.         Mov     Dh,Dl
  317. @@5:
  318.         Sub     Di,Ancho_Puntos
  319.         Mov     Word Ptr Es:[Di],Dx
  320.         Add     Dx,0101H
  321.         Cmp     Dx,Maximo+Maximo*256
  322.         Jnz     @@5
  323.         Pop     Cx Di
  324.         Add     Di,2
  325.         Loop    @@4
  326. If Syncronize
  327.         Call    Vsync
  328. Endif
  329.         Ret
  330. Print_Frame     Endp
  331.  
  332. ;***************************************************************************
  333. ;  Intercambia 'actual_page' y 'other_page' y le aplica una funcion
  334. ;  diferencial para "estabilizarla" como si fuese un fluido
  335. ;***************************************************************************
  336. Stabylize       Proc
  337.         Mov     Si,Word Ptr Cs:[Actual_Page]
  338.         Mov     Di,Word Ptr Cs:[Other_Page]
  339.         Mov     Word Ptr Cs:[Actual_Page],Di
  340.         Mov     Word Ptr Cs:[Other_Page],Si
  341.         Add     Si,Borde*Alto
  342.         Add     Di,Borde*Alto
  343.         Mov     Cl,Byte Ptr Cs:[Densidad]
  344.         Mov     Bx,Ancho*Alto/2-Borde*Alto/2
  345. @@1:
  346.         Mov     Eax,Dword Ptr Gs:[Si-Alto*2]
  347.         Add     Eax,Dword Ptr Gs:[Si+Alto*2]
  348.         Add     Eax,Dword Ptr Gs:[Si+2]
  349.         Add     Eax,Dword Ptr Gs:[Si-2]
  350.         Ror     Eax,16
  351.         Sar     Ax,1
  352.         Ror     Eax,16
  353.         Sar     Ax,1
  354.         Sub     Eax,Dword Ptr Gs:[Di]
  355.         Mov     Edx,Eax
  356.         Sar     Dx,Cl
  357.         Ror     Edx,16
  358.         Sar     Dx,Cl
  359.         Ror     Edx,16
  360.         Sub     Eax,Edx
  361.         Mov     Dword Ptr Gs:[Di],Eax
  362.         Add     Si,4
  363.         Add     Di,4
  364.         Dec     Bx
  365.         Jnz     @@1
  366.         Ret
  367. Stabylize       Endp
  368.  
  369. ;***************************************************************************
  370. ;  Intercambia 'actual_page' y 'other_page' y la modifica haciendo la
  371. ;  media aritmética de cada uno de los puntos
  372. ;***************************************************************************
  373. Stabylize2      Proc
  374.         Mov     Si,Word Ptr Cs:[Actual_Page]
  375.         Mov     Di,Word Ptr Cs:[Other_Page]
  376.         Mov     Word Ptr Cs:[Actual_Page],Di
  377.         Mov     Word Ptr Cs:[Other_Page],Si
  378.         Add     Si,Borde*Alto
  379.         Add     Di,Borde*Alto
  380.         Mov     Cx,Ancho*Alto-Borde*Alto-100
  381. @@1:
  382.         Mov     Ax,Word Ptr Gs:[Si-Alto*2]
  383.         Add     Ax,Word Ptr Gs:[Si+Alto*2]
  384.         Add     Ax,Word Ptr Gs:[Si+2]
  385.         Add     Ax,Word Ptr Gs:[Si-2]
  386.         Add     Ax,Word Ptr Gs:[Si-Alto*2-2]
  387.         Add     Ax,Word Ptr Gs:[Si-Alto*2-2]
  388.         Add     Ax,Word Ptr Gs:[Si+Alto*2-2]
  389.         Add     Ax,Word Ptr Gs:[Si+Alto*2-2]
  390.         Sar     Ax,3
  391.         Mov     Word Ptr Gs:[Di],Ax
  392.         Add     Si,2
  393.         Add     Di,2
  394.         Loop    @@1
  395.         Ret
  396. Stabylize2      Endp
  397.  
  398. ;***************************************************************************
  399. ;  Levanta un punto en el agua, de altura ESI y en las coordenadas
  400. ;  DX:BX (fila y columna)
  401. ;***************************************************************************
  402. Put_Point       Proc
  403.         Mov     Ax,Si
  404.         Rol     Esi,16
  405.         Mov     Si,Ax
  406.         Mov     Ax,Alto
  407.         Mul     Dx
  408.         Add     Bx,Ax
  409.         Shl     Bx,1
  410.         Add     Bx,Word Ptr Cs:[Actual_Page]
  411.         Mov     Dword Ptr Gs:[Bx],Esi
  412.         Mov     Dword Ptr Gs:[Bx+4],Esi
  413.         Mov     Dword Ptr Gs:[Bx+(Alto*2)],Esi
  414.         Mov     Dword Ptr Gs:[Bx+(Alto*2+4)],Esi
  415.         Mov     Dword Ptr Gs:[Bx+(Alto*4)],Esi
  416.         Mov     Dword Ptr Gs:[Bx+(Alto*4)+4],Esi
  417.         Mov     Dword Ptr Gs:[Bx+(Alto*6)],Esi
  418.         Mov     Dword Ptr Gs:[Bx+(Alto*6)+4],Esi
  419.         Ret
  420. Put_Point       Endp
  421.  
  422. ;***************************************************************************
  423. ;  Levanta un punto en el agua, de altura ESI y en las coordenadas
  424. ;  DX:BX (fila y columna) con un radio mayor que Put_Point
  425. ;***************************************************************************
  426. Put_Big_Point   Proc
  427.         Mov     Ax,Si
  428.         Rol     Esi,16
  429.         Mov     Si,Ax
  430.         Mov     Ax,Alto
  431.         Mul     Dx
  432.         Add     Bx,Ax
  433.         Shl     Bx,1
  434.         Add     Bx,Word Ptr Cs:[Actual_Page]
  435.         Mov     Dword Ptr Gs:[Bx],Esi
  436.         Mov     Dword Ptr Gs:[Bx+4],Esi
  437.         Mov     Dword Ptr Gs:[Bx+8],Esi
  438.         Mov     Dword Ptr Gs:[Bx+10],Esi
  439.         Mov     Dword Ptr Gs:[Bx+(Alto*2)],Esi
  440.         Mov     Dword Ptr Gs:[Bx+(Alto*2+4)],Esi
  441.         Mov     Dword Ptr Gs:[Bx+(Alto*2+8)],Esi
  442.         Mov     Dword Ptr Gs:[Bx+(Alto*2+10)],Esi
  443.         Mov     Dword Ptr Gs:[Bx+(Alto*4)],Esi
  444.         Mov     Dword Ptr Gs:[Bx+(Alto*4)+4],Esi
  445.         Mov     Dword Ptr Gs:[Bx+(Alto*4)+8],Esi
  446.         Mov     Dword Ptr Gs:[Bx+(Alto*4)+10],Esi
  447.         Mov     Dword Ptr Gs:[Bx+(Alto*6)],Esi
  448.         Mov     Dword Ptr Gs:[Bx+(Alto*6)+4],Esi
  449.         Mov     Dword Ptr Gs:[Bx+(Alto*6)+8],Esi
  450.         Mov     Dword Ptr Gs:[Bx+(Alto*6)+10],Esi
  451.         Mov     Dword Ptr Gs:[Bx+(Alto*8)],Esi
  452.         Mov     Dword Ptr Gs:[Bx+(Alto*8)+4],Esi
  453.         Mov     Dword Ptr Gs:[Bx+(Alto*8)+8],Esi
  454.         Mov     Dword Ptr Gs:[Bx+(Alto*8)+10],Esi
  455.         Mov     Dword Ptr Gs:[Bx+(Alto*10)],Esi
  456.         Mov     Dword Ptr Gs:[Bx+(Alto*10)+4],Esi
  457.         Mov     Dword Ptr Gs:[Bx+(Alto*10)+8],Esi
  458.         Mov     Dword Ptr Gs:[Bx+(Alto*10)+10],Esi
  459.         Ret
  460. Put_Big_Point   Endp
  461.  
  462. ;***************************************************************************
  463. ;  Levanta un punto en posición aleatoria con altura ESI
  464. ;***************************************************************************
  465. Touch   Proc
  466.         Push    Esi
  467.         Call    Read_Point
  468.         Pop     Esi
  469.         Shr     Dx,1
  470.         Call    Put_Point
  471.         Ret
  472. Touch   Endp
  473.  
  474. ;***************************************************************************
  475. ;  Levanta un punto en posición aleatoria con altura ESI, con un radio
  476. ;  mayor que mediante Touch
  477. ;***************************************************************************
  478. Big_Touch       Proc
  479.         Push    Esi
  480.         Call    Read_Point
  481.         Pop     Esi
  482.         Shr     Dx,1
  483.         Call    Put_Big_Point
  484.         Ret
  485. Big_Touch       Endp
  486.  
  487. ;***************************************************************************
  488. ;  Levanta una linea vertical en el agua, en la columna DX y de altura SI
  489. ;***************************************************************************
  490. Put_Line        Proc
  491.         Mov     Ax,Si
  492.         Rol     Esi,16
  493.         Mov     Si,Ax
  494.         Mov     Ax,Alto*2
  495.         Mul     Dx
  496.         Mov     Bx,Ax
  497.         Add     Bx,Ancho_Olas
  498.         Mov     Cx,Alto/2-Ancho_Olas
  499.         Add     Bx,2*8
  500.         Sub     Cx,2*8
  501. @@1:
  502.         Mov     Dword Ptr Gs:[Bx],Esi
  503.         Mov     Dword Ptr Gs:[Bx+Alto*2],Esi
  504.         Mov     Dword Ptr Gs:[Bx+Alto*4],Esi
  505.         Mov     Dword Ptr Gs:[Bx+Alto*6],Esi
  506.         Mov     Dword Ptr Gs:[Bx+Alto*8],Esi
  507.         Mov     Dword Ptr Gs:[Bx+Alto*10],Esi
  508.         Add     Bx,4
  509.         Loop    @@1
  510.         Ret
  511. Put_Line        Endp
  512.  
  513. ;***************************************************************************
  514. ;  Levanta el siguiente punto de la función senoidal
  515. ;***************************************************************************
  516. Touch_Sinus     Proc A:Word
  517.         Push    Esi
  518.         Call    Read_Sinus,A
  519.         Pop     Esi
  520.         Call    Put_Point
  521.         Ret
  522. Touch_Sinus     Endp
  523.  
  524. ;***************************************************************************
  525. ;  Imprime una pantalla y la estabiliza con la rutina apuntada por BX
  526. ;  durante CX veces
  527. ;***************************************************************************
  528. Print   Proc
  529. @@1:
  530.         Push    Cx Bx
  531.         Call    Print_Frame
  532.         Pop     Bx
  533.         Push    Bx
  534.         Call    Bx
  535.         Pop     Bx
  536.         Pop     Cx
  537.         Loop    @@1
  538.         Ret
  539. Print   Endp
  540.  
  541. ;***************************************************************************
  542. ;  Lee el siguiente valor de la función senoidal
  543. ;***************************************************************************
  544. Read_Sinus      Proc A:Word
  545.         Shl     A,1
  546. @@11:
  547.         Mov     Bx,A
  548.         Mov     Si,Word Ptr Cs:[Fil+Bx]
  549.         Mov     Cx,Word Ptr Cs:[Fila+Si]
  550.         Cmp     Cx,0Ffffh
  551.         Jnz     @@1
  552.         Mov     Bx,A
  553.         Mov     Word Ptr Cs:[Fil+Bx],0
  554.         Jmp     @@11
  555. @@1:
  556.         Mov     Bx,A
  557.         Mov     Si,Word Ptr Cs:[Col+Bx]
  558.         Mov     Dx,Word Ptr Cs:[Columna+Si]
  559.         Cmp     Dx,0Ffffh
  560.         Jnz     @@2
  561.         Mov     Bx,A
  562.         Mov     Word Ptr Cs:[Col+Bx],0
  563.         Jmp     @@1
  564. @@2:
  565.         Mov     Bx,A
  566.         Add     Word Ptr Cs:[Col+Bx],2
  567.         Add     Word Ptr Cs:[Fil+Bx],2
  568.         Mov     Bx,Cx
  569.         Ret
  570. Col     Label
  571.         Dw      5 Dup(0)
  572. Fil     Label
  573.         Dw      5 Dup(0)
  574. Clear_Sinus     Proc
  575.         Mov     Word Ptr Cs:[Col],10
  576.         Mov     Word Ptr Cs:[Col+2],20
  577.         Mov     Word Ptr Cs:[Col+4],40
  578.         Mov     Word Ptr Cs:[Col+6],0
  579.         Mov     Word Ptr Cs:[Col+8],0
  580.         Mov     Word Ptr Cs:[Fil],50
  581.         Mov     Word Ptr Cs:[Fil+2],20
  582.         Mov     Word Ptr Cs:[Fil+4],40
  583.         Mov     Word Ptr Cs:[Fil+6],40
  584.         Mov     Word Ptr Cs:[Fil+8],0
  585.         Ret
  586. Clear_Sinus     Endp
  587. Columna Label
  588.         Dw      015,015,016,016,017,018,020,021,023,025,027,030
  589.         Dw      033,036,039,042,045,049,052,056,060,064,068,072
  590.         Dw      076,080,084,088,092,096,000,104,108,111,115,118
  591.         Dw      121,124,127,130,133,135,137,139,140,142,143,144
  592.         Dw      144,145,145,145,144,144,143,142,140,139,137,135
  593.         Dw      133,130,127,124,121,118,115,111,108,104,100,096
  594.         Dw      092,088,084,080,076,072,068,064,060,056,052,049
  595.         Dw      045,042,039,036,033,030,027,025,023,021,020,018
  596.         Dw      017,016,016,015
  597.         Dd      0Ffffffffh
  598. Fila    Label
  599.         Dw      025,025,026,027,028,030,032,034,037,039,042,045
  600.         Dw      048,052,055,058,061,063,066,068,070,072,073,074
  601.         Dw      075,075,075,074,073,072,070,068,066,063,061,058
  602.         Dw      055,052,048,045,042,039,037,034,032,030,028,027
  603.         Dw      026,025
  604.         Dd      0Ffffffffh
  605. Read_Sinus      Endp
  606.  
  607. ;***************************************************************************
  608. ;  Devuelve unas coordenadas "pseudoaleatorias" en DX:BX
  609. ;***************************************************************************
  610. Read_Point      Proc
  611.         Call    Rnd_Calc
  612.         And     Dx,11111111B
  613.         Add     Dx,32
  614.         Push    Dx
  615.         Call    Rnd_Calc
  616.         Mov     Bx,Dx
  617.         Pop     Dx
  618.         And     Bx,1111111B
  619.         Add     Bx,36
  620.         Ret
  621. Rnd_Calc:
  622.         Inc     Cs:Rnd
  623.         Xor     Dx,Dx
  624.         Mov     Ax,Cs:Rnd
  625.         Mov     Bx,32719
  626.         Mul     Bx
  627.         Add     Ax,3                    
  628.         Mov     Bx,32749                
  629.         Div     Bx
  630.         Add     Dx,0F000H
  631.         Mov     Cs:Rnd,Dx
  632.         Ret
  633. Rnd     Label   Word
  634.         Dw      0000H
  635. Read_Point      Endp
  636.  
  637. Density Macro   Densidad_Variable
  638.         Mov     Byte Ptr Cs:[Densidad],Densidad_Variable
  639.         Endm
  640.  
  641. P@001   Proc
  642.         Xor     Si,Si
  643.         Mov     Cx,40
  644. @@2:
  645.         Push    Cx
  646.         Mov     Cx,3
  647. @@1:
  648.         Push    Cx Si
  649.         Call    Big_Touch
  650.         Call    Stabylize
  651.         Call    Print_Frame
  652.         Call    Stabylize
  653.         Call    Print_Frame
  654.         Call    Stabylize
  655.         Call    Print_Frame
  656.         Call    Stabylize
  657.         Call    Print_Frame
  658.         Pop     Si Cx
  659.         Loop    @@1
  660.         Add     Si,25
  661.         Pop     Cx
  662.         Loop    @@2
  663.         Mov     Cx,40
  664. @@12:
  665.         Push    Cx
  666.         Mov     Cx,3
  667. @@11:
  668.         Push    Cx Si
  669.         Call    Big_Touch
  670.         Call    Stabylize
  671.         Call    Print_Frame
  672.         Call    Stabylize
  673.         Call    Print_Frame
  674.         Call    Stabylize
  675.         Call    Print_Frame
  676.         Call    Stabylize
  677.         Call    Print_Frame
  678.         Pop     Si Cx
  679.         Loop    @@11
  680.         Sub     Si,20
  681.         Pop     Cx
  682.         Loop    @@12
  683.         Ret
  684. P@001   Endp
  685.  
  686. P@002   Proc
  687.         Mov     Cx,5
  688. @@2:
  689.         Push    Cx
  690.         Mov     Si,3000
  691.         Mov     Dx,320/4
  692.         Mov     Bx,150
  693.         Call    Put_Point
  694.         Mov     Cx,50
  695. @@3:
  696.         Push    Cx
  697.         Mov     Si,300
  698.         Call    Touch
  699.         Mov     Si,200
  700.         Call    Touch
  701.         Mov     Si,100
  702.         Call    Touch
  703.         Call    Stabylize
  704.         Call    Print_Frame
  705.         Pop     Cx
  706.         Loop    @@3
  707.         Pop     Cx
  708.         Loop    @@2
  709.         Mov     Cx,80
  710. @@4:
  711.         Push    Cx
  712.         Call    Stabylize
  713.         Call    Print_Frame
  714.         Pop     Cx
  715.         Loop    @@4
  716.         Ret
  717. P@002   Endp
  718.  
  719. P@003   Proc
  720.         Mov     Cx,30
  721. @@1:
  722.         Push    Cx
  723.         Mov     Si,-4000
  724.         Call    Big_Touch
  725.         Call    Stabylize2
  726.         Call    Print_Frame
  727.         Mov     Si,-4000
  728.         Call    Big_Touch
  729.         Call    Stabylize2
  730.         Call    Print_Frame
  731.         Mov     Si,-4000
  732.         Call    Big_Touch
  733.         Call    Stabylize2
  734.         Call    Print_Frame
  735.         Pop     Cx
  736.         Loop    @@1
  737.         Mov     Cx,20
  738. @@4:
  739.         Push    Cx
  740.         Call    Stabylize2
  741.         Call    Print_Frame
  742.         Pop     Cx
  743.         Loop    @@4
  744.         Ret
  745. P@003   Endp
  746.  
  747. P@004   Proc
  748.         Mov     Cx,7
  749. @@2:
  750.         Push    Cx
  751.         Mov     Si,3000
  752.         Mov     Dx,320/4
  753.         Mov     Bx,150
  754.         Call    Put_Point
  755.         Mov     Cx,5
  756. @@3:
  757.         Push    Cx
  758.         Call    Stabylize
  759.         Call    Print_Frame
  760.         Pop     Cx
  761.         Loop    @@3
  762.         Mov     Si,-2000
  763.         Mov     Dx,320/4
  764.         Mov     Bx,150
  765.         Call    Put_Point
  766.         Mov     Cx,30
  767. @@6:
  768.         Push    Cx
  769.         Call    Stabylize
  770.         Call    Print_Frame
  771.         Pop     Cx
  772.         Loop    @@6
  773.         Pop     Cx
  774.         Loop    @@2
  775.         Mov     Cx,80
  776. @@4:
  777.         Push    Cx
  778.         Call    Stabylize
  779.         Call    Print_Frame
  780.         Pop     Cx
  781.         Loop    @@4
  782.         Ret
  783. P@004   Endp
  784.  
  785. P@005   Proc    A:Word,B:Word
  786.         Mov     Si,800
  787.         Mov     Cx,150
  788. @@1:
  789.         Push    Cx Esi
  790.         Cmp     A,4
  791.         Jz      @@5
  792.         Cmp     A,3
  793.         Jz      @@4
  794.         Cmp     A,2
  795.         Jz      @@3
  796.         Cmp     A,1
  797.         Jz      @@2
  798.         Call    Touch_Sinus,0
  799. @@2:
  800.         Call    Touch_Sinus,1
  801. @@3:
  802.         Call    Touch_Sinus,2
  803. @@4:
  804.         Call    Touch_Sinus,3
  805. @@5:
  806.         Call    Touch_Sinus,4
  807.         Mov     Cx,B
  808.         Mov     Bx,Offset Stabylize
  809.         Call    Print
  810.         Pop     Esi Cx
  811.         Loop    @@1
  812.         Ret
  813. P@005   Endp
  814.  
  815. P@006   Proc    A:Word,B:Word
  816.         Mov     Si,-1500
  817.         Mov     Cx,4
  818. @@1:
  819.         Push    Cx Si
  820.         Mov     Dx,1
  821.         Cmp     A,0
  822.         Jz      @@S1
  823.         Call    Put_Line
  824. @@S1:
  825.         Mov     Cx,50
  826. @@3:
  827.         Push    Cx
  828.         Mov     Si,250
  829.         Cmp     B,0
  830.         Jz      @@S2
  831.         Call    Touch
  832. @@S2:
  833.         Call    Stabylize
  834.         Call    Print_Frame
  835.         Call    Stabylize
  836.         Call    Print_Frame
  837.         Pop     Cx
  838.         Loop    @@3
  839.         Pop     Si Cx
  840.         Loop    @@1
  841.         Ret
  842. P@006   Endp
  843.  
  844. Stabylize_Water Proc
  845.         Mov     Cx,100
  846.         Mov     Bx,Offset Stabylize
  847.         Call    Print
  848.         Ret
  849. Stabylize_Water Endp
  850.  
  851. End_Msg Proc
  852.         Push    Cs
  853.         Pop     Ds
  854.         Mov     Dx,Offset @@1
  855.         Mov     Ah,09H
  856.         Int     21H
  857.         Ret
  858. @@1     Label
  859.         Db      '≡ Water by DΣ-PhÄSSΣD! from RESET-TVC, 12-11-1995, Castelldefels-BARCELONA',Crlf,Crlf
  860.  
  861.         Db      '■ IGUANA,  grupo español dedikado  a la DemoSzene y  ganador del 2º premio',Crlf
  862.         Db      '  internazional  Assembly`94,  usó por primera vez  una téknika  LandsKape',Crlf
  863.         Db      '  para representar éste efekto en su SuperMegaDemo "Heartquake".',Crlf
  864.         Db      '  Posteriormente,  ha editado algún  dokumento  deskribiendo las komplejas',Crlf
  865.         Db      '  funziones diferenziales y  las  téknikas  para  el  desarrollo  de  ésta',Crlf
  866.         Db      '  maravilla, sin los kuales yo jamás hubiese konseguido programarla...',Crlf
  867.         Db      '  LOTZ OF ZANX, IGUANA!! ;) ;)',Crlf
  868.  
  869.         Db      '■ Kreo k es éste  uno de los efektos  más impaktantes k he visto  jamás en',Crlf
  870.         Db      '  la  DemoSzene  internazional, kizás por k nos enturbia la konzepzión  de',Crlf
  871.         Db      '  "kaos" mostrándonos artifiziosamente  el suzeder natural  y  su kompleja',Crlf
  872.         Db      '  belleza de infinitas formas armoniosas a través de unos silenziosos pero',Crlf
  873.         Db      '  ardientes trozos de silizio...',Crlf
  874.  
  875.         Db      '■ GREETZ: Chc,Dyonisos,Elfo,KingGraham,Joanmi_Bardera,Gianola,Magic,Tarod,',Crlf
  876.         Db      '  Terminator,JaMiRo,Kalss,TLU,Kiefer,Trojan,Night_Warrior,Franky,Bitspawn,',Crlf
  877.         Db      '  LuisCrespo,Iguana,Micaco BBS,Quartz BBS,UAB BBS and... all the other! ;)',Crlf
  878.  
  879.         Db      '■ Internet: oiram@bbs-ce.uab.es',Crlf
  880.         Db      '  Telefono: +34-3-6645527 (Mario, Oiram o DΣ-PhÄSSΣD!) ;)',Crlf
  881.         Db      '  Korreo konvenzional: C/Gral.Palafox, 4, Atcº3ª',Crlf
  882.         Db      '                       08860 Castelldefels,Barcelona. ESPAÑA',Crlf,Crlf
  883.         Db      '■ oh! and.. remember! Timophonika, fuck u again, and again, and again, and',Crlf
  884.         Db      '  again, and again, and again, and again, and again, and again, and.. XD!!','$'
  885.  
  886.  
  887.  
  888.         Db      '(C) DΣ-PhÄSSΣD! 1995',0Dh,0Ah,0Dh,0Ah,'$'
  889. End_Msg Endp
  890.  
  891. Main:
  892.         Call    St_Lidt
  893.         Call    Irqs_Out
  894.         Call    Set_Irq1
  895.         Call    Put_320
  896.         Density Densidad_Inicial
  897.         Mov     Bx,Offset Stabylize
  898.         Mov     Cx,1
  899.         Call    Print
  900.         Call    Zero_Pal
  901.         Call    Put_Palette
  902.         Push    Es
  903.         Mov     Ax,0A000H
  904.         Mov     Es,Ax
  905.         Mov     Di,320*101
  906.         Mov     Cx,320/4
  907.         Mov     Eax,63636363H
  908.         Rep     Stosd
  909.         Pop     Es
  910.  
  911. Again:
  912.         Mov     Rnd,Semilla_Inicial
  913.         Density Densidad_Inicial
  914.         Call    P@001
  915.         Call    P@002
  916.         Density 6
  917.         Call    P@003
  918.         Call    Stabylize_Water
  919.         Call    P@003
  920.         Call    Stabylize_Water
  921.         Density 5
  922.         Call    P@004
  923.         Call    Stabylize_Water
  924.         Call    Clear_Sinus
  925.         Call    P@005,4,2
  926.         Call    P@005,3,2
  927.         Call    P@005,2,2
  928.         Call    P@005,4,1
  929.         Call    P@005,4,1
  930.         Call    P@005,3,1
  931.         Density 6
  932.         Call    P@006,1,0
  933.         Call    P@006,1,1
  934.         Call    P@006,0,1
  935.         Jmp     Again
  936. End_Proc:
  937.         Call    Restore_Imr
  938.         Call    Zero_Pal
  939.         Call    Text_Mode
  940.         Call    End_Msg
  941.         Mov     Ax,4C00H
  942.         Int     21H
  943.  
  944. Palette Label
  945. Db      03Fh,03Fh,03Fh,03Ch,03Fh,03Fh,03Ah,03Fh,03Fh,037H,03Eh,03Fh,034H,03Eh,03Fh,032H
  946. Db      03Eh,03Fh,02Fh,03Eh,03Fh,02Dh,03Dh,03Fh,02Ah,03Dh,03Fh,029H,03Ch,03Fh,028H,03Bh
  947. Db      03Fh,027H,03Bh,03Fh,027H,03Bh,03Fh,026H,03Ah,03Fh,025H,039H,03Fh,024H,038H,03Fh
  948. Db      023H,037H,03Fh,022H,037H,03Fh,021H,036H,03Fh,020H,035H,03Fh,01Fh,034H,03Fh,01Eh
  949. Db      033H,03Fh,01Dh,032H,03Fh,01Ch,031H,03Fh,01Bh,030H,03Fh,01Ah,02Fh,03Fh,019H,02Eh
  950. Db      03Fh,018H,02Dh,03Fh,017H,02Ch,03Fh,016H,02Ah,03Fh,015H,029H,03Fh,014H,028H,03Fh
  951. Db      013H,027H,03Fh,012H,025H,03Eh,011H,025H,03Dh,011H,023H,03Dh,010H,022H,03Ch,00Fh
  952. Db      020H,03Bh,00Fh,020H,03Ah,00Eh,01Eh,039H,00Dh,01Dh,039H,00Ch,01Bh,038H,00Ch,01Bh
  953. Db      037H,00Bh,019H,036H,00Bh,018H,035H,00Ah,016H,035H,009H,016H,034H,009H,014H,033H
  954. Db      008H,013H,032H,007H,012H,031H,007H,011H,031H,006H,010H,030H,006H,00Fh,02Fh,005H
  955. Db      00Eh,02Fh,005H,00Dh,02Eh,004H,00Ch,02Dh,004H,00Bh,02Ch,003H,00Ah,02Bh,003H,009H
  956. Db      02Bh,002H,008H,02Ah,002H,007H,029H,002H,006H,028H,001H,006H,027H,001H,004H,027H
  957. Db      001H,004H,026H,001H,004H,026H,001H,004H,026H,001H,004H,025H,001H,004H,025H,001H
  958. Db      004H,025H,001H,004H,024H,000H,004H,024H,000H,004H,024H,000H,004H,023H,000H,003H
  959. Db      023H,000H,003H,022H,000H,003H,022H,000H,003H,022H,000H,003H,021H,000H,003H,021H
  960. Db      000H,003H,021H,000H,003H,020H,000H,003H,020H,000H,003H,020H,000H,003H,020H,000H
  961. Db      003H,01Fh,000H,003H,01Fh,000H,003H,01Fh,000H,003H,01Eh,000H,003H,01Eh,000H,002H
  962. Db      01Eh,000H,002H,01Dh,000H,002H,01Dh,000H,002H,019H,000H,002H,016H,000H,001H,012H
  963. Db      000H,001H,00Fh,000H,000H,00Ah,000H,000H,005H,000H,000H,000H,00Eh,000H,000H,013H
  964. Db      000H,000H,018H,000H,000H,01Dh,000H,000H,022H,000H,000H,027H,000H,000H,02Ch,000H
  965. Db      000H,031H,000H,000H,034H,000H,000H,038H,000H,000H,037H,000H,000H,036H,000H,002H
  966. Db      035H,000H,004H,035H,000H,005H,034H,000H,008H,033H,000H,009H,033H,000H,00Ah,032H
  967. Db      000H,00Bh,031H,000H,00Ch,030H,000H,00Dh,030H,001H,00Eh,02Fh,000H,00Fh,02Eh,000H
  968. Db      010H,02Eh,000H,010H,02Dh,000H,012H,02Ch,001H,013H,02Ch,001H,014H,02Bh,001H,014H
  969. Db      02Ah,001H,015H,029H,001H,016H,029H,001H,016H,028H,001H,017H,029H,003H,019H,02Ah
  970. Db      005H,01Bh,02Ch,008H,01Dh,02Dh,00Bh,01Fh,02Eh,00Dh,020H,02Fh,010H,022H,031H,013H
  971. Db      025H,032H,017H,027H,033H,01Ah,029H,034H,01Eh,02Bh,036H,021H,02Dh,037H,025H,030H
  972. Db      038H,029H,032H,03Ah,02Dh,034H,03Bh,031H,037H,03Ch,036H,03Ah,03Eh,03Ah,03Ch,03Fh
  973. Db      03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh
  974.  
  975. Imr     Label   Byte
  976.         Db      00H
  977. Other_Page      Label   Word
  978.         Dw      Alto*Ancho*2
  979. Actual_Page     Label   Word
  980.         Dw      0000
  981. Densidad        Label   Byte
  982.         Db      00H
  983. Old_09H Label
  984.         Dd      00000000H
  985. Uninit  Segment
  986. Uninit  Ends
  987.         End     Main
  988.